﻿<UserControl x:Class="LeoK.TM.ReportA"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:LeoK.TM"
             xmlns:common="clr-namespace:LeoK.Common"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             xmlns:converter="clr-namespace:LeoK.Common.Converter"
             mc:Ignorable="d" 
             d:DesignHeight="600" d:DesignWidth="800">
    <UserControl.Resources>
        <converter:MinutesToStringConverter x:Key="MinutesToStringConverter" />
        <DataTemplate x:Key="pointTemplate">
            <Ellipse Width="10" Height="10" Stroke="DarkRed" StrokeThickness="2" >
                <Ellipse.Fill>
                    <SolidColorBrush Color="White" />
                </Ellipse.Fill>
            </Ellipse>
        </DataTemplate>
    </UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        
        <StackPanel Height="30" Margin="5" HorizontalAlignment="Left" Orientation="Horizontal" >
            <common:DataSpanSelector x:Name="DataSpanSelector"  />
        </StackPanel>
        <Grid Grid.Row="1">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            
            <TextBlock Text="每日时间成本图" FontSize="15" FontWeight="ExtraBold" Grid.ColumnSpan="2" VerticalAlignment="Center" HorizontalAlignment="Center"  />
            
            <telerik:RadCartesianChart Grid.Row="1"  x:Name="chart" >
                <telerik:RadCartesianChart.Behaviors>
                    <telerik:ChartTooltipBehavior Placement="Relative" />
                </telerik:RadCartesianChart.Behaviors>
                <telerik:RadCartesianChart.TooltipTemplate>
                    <DataTemplate>
                        <Border Width="150" Height="50" Background="AliceBlue">
                            <StackPanel Margin="5">
                                <TextBlock Text="{Binding Path=DataItem.Date, StringFormat='yyyy/MM/dd dddd', ConverterCulture=zh-CN}" />
                                <TextBlock Text="{Binding Path=DataItem.Value, Converter={StaticResource MinutesToStringConverter}}" />
                            </StackPanel>
                        </Border>
                    </DataTemplate>
                </telerik:RadCartesianChart.TooltipTemplate>
                <telerik:RadCartesianChart.HorizontalAxis >
                    <telerik:DateTimeCategoricalAxis x:Name="HAxis" Height="50" LabelFormat="dd"/>
                </telerik:RadCartesianChart.HorizontalAxis>

                <telerik:RadCartesianChart.VerticalAxis >
                    <telerik:LinearAxis x:Name="VAxis" LabelFormat="0" 
                                        MajorStep="30"
                                        />
                </telerik:RadCartesianChart.VerticalAxis>
            </telerik:RadCartesianChart>
            
            <telerik:RadListBox Grid.Row="1" x:Name="lstLegend" Background="Transparent" Grid.Column="1" Width="200" Margin="5" BorderThickness="0">
                <telerik:RadListBox.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Horizontal">
                            <CheckBox IsChecked="{Binding IsSelected}">
                                <CheckBox.Content>
                                    <StackPanel Orientation="Horizontal">
                                        <Rectangle Fill="{Binding LineColor}" Margin="2" Height="10" Width="10" />
                                        <TextBlock Text="{Binding Name}" />
                                    </StackPanel>
                                </CheckBox.Content>
                            </CheckBox>
                        </StackPanel>
                    </DataTemplate>
                </telerik:RadListBox.ItemTemplate>
            </telerik:RadListBox>
        </Grid>
        
        <Grid Grid.Row="2" Margin="5">

            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>

            <TextBlock Text="项目占用比图" FontSize="15" FontWeight="ExtraBold" VerticalAlignment="Center" HorizontalAlignment="Center"  />
            <TextBlock Text="时间分布图" Grid.Column="1" FontSize="15" FontWeight="ExtraBold" VerticalAlignment="Center" HorizontalAlignment="Center"  />


            <telerik:RadPieChart Grid.Row="1" x:Name="PieChart">
                <telerik:RadPieChart.Series>
                    <telerik:PieSeries x:Name="PieSeries"
                                       ValueBinding="Value" 
                                       ShowLabels="True"
                                       
                                        >
                        <telerik:PieSeries.LabelDefinitions>
                            <telerik:ChartSeriesLabelDefinition HorizontalAlignment="Center" VerticalAlignment="Center" >
                                <telerik:ChartSeriesLabelDefinition.Template>
                                    <DataTemplate>
                                        <StackPanel Orientation="Horizontal">
                                            <TextBlock Foreground="White" Text="{Binding DataItem.Name}" />
                                            <TextBlock Foreground="White" Text="(" />
                                            <TextBlock Foreground="White" Text="{Binding DataItem.Value, Converter={StaticResource MinutesToStringConverter}}"/>
                                            <TextBlock Foreground="White" Text=")" />
                                        </StackPanel>
                                    </DataTemplate>
                                </telerik:ChartSeriesLabelDefinition.Template>
                            </telerik:ChartSeriesLabelDefinition>
                        </telerik:PieSeries.LabelDefinitions>
                    </telerik:PieSeries>
                </telerik:RadPieChart.Series>
            </telerik:RadPieChart>

            <Grid Grid.Row="1" Grid.Column="1">
                <telerik:RadRadialGauge Margin="10"  >
                    <telerik:RadialScale StartAngle="-90" 
                                         x:Name="RadialScale"
                                         Fill="Red"
                                         MajorTickStep="1"
                                         SweepAngle="360"
                                         Min="0"
                                         telerik:StyleManager.Theme="Windows8"
                                         ShowFirstLabel="False"
                                         Max="24">
                    </telerik:RadialScale>
                </telerik:RadRadialGauge>
            </Grid>
        </Grid>
    </Grid>
</UserControl>
